#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <crtdbg.h>
#include <assert.h>
#include <string.h>
#include "object.h"
#include "new.h"
#include "list.h"
#include "hash.h" 


#define _CRTDBG_MAP_ALLOC




void main()
{
	struct Object* obj;
	Pointer check;
	Pointer ht;
	char b[] = "123";

	obj = new(Object, 1, 1, 1);
	ht = new(HashTable, 10, NULL);
	assert(ht_has(ht, b)==0);

	ht_set(ht, b, obj);
	check = ht_get(ht, b);
	assert(((struct Object*)check)->r==((struct Object*)obj)->r);
	assert(ht_has(ht, b)==1);

	ht_delete(ht, b);
	assert(ht_has(ht, b)==0);

	ht_set(ht, b, obj);
	assert(ht_has(ht, b)==1);

	ht_resize(ht, 20);
	assert(ht_has(ht, b)==1);

	ht_delete(ht, b);
	assert(ht_has(ht, b)==0);

	delete(ht);
	delete(obj);

	//getch();
	_CrtDumpMemoryLeaks();
}